package com.yuan.mqtt.web;

import com.yuan.mqtt.client.MqttPushClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Classname TestController
 * @Description :
 * @Date 2021/9/14 16:16
 * @Author cfy
 */
@Controller
@ResponseBody
public class TestController {
    @Autowired
    private MqttPushClient mqttPushClient;


    @RequestMapping("/testPushMessage")
    public void pushMessage(HttpServletRequest request) {
        String message = request.getParameter("message");
        mqttPushClient.pushlish("test1", message);
    }
}
